<template>
  <div class="mod-config">
    <table-view ref="view"
                :searchAttrs="searchAttrs"
                :primaryKey="primaryKey"
                :listApiName="listApiName"
                :deleteApiName="deleteApiName"
                :saveAuthName="saveAuthName"
                :deleteAuthName="deleteAuthName"
                :exportApiName="exportApiName"
                :showAttrs="showAttrs"
                :templateDownloadApiName="templateDownloadApiName"
                :importApiName="importApiName"
                :sumInfo='sumInfo'
    >
    </table-view>
    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  </div>
</template>

<script>
import AddOrUpdate from './financeOughtReceive-add-or-update'
import tableView from '@/components/tableView'
import basicMixins from '@/utils/commonViewMixins'

export default {
  mixins: [basicMixins],
  data() {
    return {
      searchAttrs: {
        clientId: {
          placeholder: '客户名称',
          type: 'autoComplete',
          querySearchApiName: 'clientApi/getClientList'
        },
        vouchAccount: {
          placeholder: '收款账户',
          clearable: true,
          type: 'autoComplete',
          querySearchApiName: 'financeApi/getFinanceAccountInfoList'
        },
        createUser: {
          label: '销售',
          clearable: true,
          type: 'autoComplete',
          placeholder: '请选择业务人员',
          querySearchApiName: 'systemApi/listSaleUser'

        },
        dateTimeRange:{
          type: 'date',
          dateType: 'daterange',
          clearable: true
        }
      },
      showAttrs: {
        vouchAccount: {
          label: '收款账号',
          type: 'radio',
          items: [
            {value: 1, text: '公户（人民币）',tagType: 'danger'},
            {value: 2, text: '公户（美元）',tagType: 'success'},
            {value: 3, text: '个人（人民币）',tagType: 'danger'},
            {value: 4, text: '个人（美元）',tagType: 'success'},
          ]
        },
        vouchType: {
          label: '款项类型',
          type: 'radio',
          items: [
            {value: 0, text: '应收款'},
            {value: 1, text: '预付款',tagType: 'success'},
            {value: 2, text: '其他费用',tagType: 'danger'},
            {value: 99, text: '调账（客户抹零） ',tagType: 'info'},
          ]
        },
        clientContractNo:{
          label: '客户合同编号',
          type: 'linkLabel',
          searchKey: 'clientContractNo',
          routerName: 'contract-contractorderinfo'
        },
        amount: {label: '金额',type:'money',currencyType: 'vouchAccount'},
        // itemName: {label: '用途,项目名称'},
        clientName: {label: '客户名称'},
        vouchDate: {label: '收款日期',type: 'date'},
        saleName: {
          label: '业务员',
          width: 120
        },
        remark: {label: '备注'},
        status: {
          label: '状态',
          type: 'radio',
          items: [
            {value: 0, text: '禁用', tagType: 'danger'},
            {value: 1, text: '正常'}
          ]
        }
      },
      sumInfo: {amount: 'amount'},
      primaryKey: 'id',
      listApiName: 'financeApi/listFinanceOughtReceivable',
      deleteApiName: 'financeApi/deleteFinanceOughtReceivable',
      saveAuthName: 'finance:financeoughtreceive:save',
      deleteAuthName: 'finance:financeoughtreceive:delete',
      exportApiName: 'financeApi/getFinanceOutReceiveExport',
      templateDownloadApiName: 'financeApi/templateDownloadFinanceOughtReceive',
      importApiName: 'financeApi/importFinanceOughtReceive'
    }
  },
  components: {
    AddOrUpdate,
    tableView
  }
}
</script>
